package com.kiln.juxingqs.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView
import client.global.commlib.base.BaseLoadmoreAdapter
import client.global.commlib.base.BindingViewHoder
import com.kiln.juxingqs.R
import com.kiln.juxingqs.api.bean.Zcjl
import com.kiln.juxingqs.databinding.LayoutRechargejlitemBinding

import com.bumptech.glide.RequestManager

class RechargeRecordAdapter : BaseLoadmoreAdapter<Zcjl.Record> {

    val manager: RequestManager

    constructor(context: Context, manager: RequestManager) : super(context) {
        this.manager = manager
    }

    override fun createVh(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return BindingViewHoder(
            DataBindingUtil.inflate(
                layoutInflater,
                R.layout.layout_rechargejlitem,
                parent,
                false
            )
        )
    }

    override fun bindVh(holder: RecyclerView.ViewHolder, position: Int) {
        val bindingViewHolder = holder as BindingViewHoder<ViewDataBinding>
        val binding = bindingViewHolder.binding as LayoutRechargejlitemBinding

        val bean = getItem(position)
        binding.bean = bean

        when (bean.status) {
            0 -> {
                binding.status = "审核中"
            }
            1 -> {
                binding.status = "成功"
            }
            2 -> {
                binding.status = "失败"
            }
            3 -> {
                binding.status = "撤消"
            }
        }

    }
}